/***
 * 获取当前页面的url参数
 * @returns url的参数列表
 */
function getQueryParams() {
    const params = {};
    const hash = window.location.hash;
    const queryString = hash.includes('?') ? hash.split('?')[1] : '';

    if (!queryString) {
        console.log("No query string found in the URL");
        return params;
    }

    const vars = queryString.split('&');
    vars.forEach((pair) => {
        const [key, value] = pair.split('=');
        if (key && value) {
            params[key] = decodeURIComponent(value);
        }
    });
    return params;
}

/***
 * 合并两个json
 * @param json1
 * @param json2
 * @returns {*}
 */
function mergeJson(json1, json2) {
    const result = {...json1};

    for (const key in json2) {
        if (json2.hasOwnProperty(key)) {
            if (result[key] && typeof result[key] === 'object' && typeof json2[key] === 'object') {
                result[key] = mergeJson(result[key], json2[key]);
            } else {
                result[key] = json2[key];
            }
        }
    }

    return result;
}